<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>用户注册</title>
		<script type="text/javascript">
			function checkUser(){
				if(checkUsername()&&checkPassword()){
					return true;
				}
				return false;
			}
			function checkUsername(){
				var username = document.forms[0].username.value;
				
				if(username.length == 0){
					alert("用户名不能为空");
					return false;
				}
				
				for(i = 0;i < username.length;i++){
					c = username.charAt(i);
					
					if(c >= 0 && c <= 9 || (c >= 'a'&& c<= 'z') || (c >= 'A'&& c <= 'Z')){
						alert("有非法字符！")
						return false;
					}
				}
				
				
				return true;
			}
				
			function checkPassword(){
				var password = document.forms[0].password .value;
				
				if(password.length == 0){
					alert("密码不能为空");
					return false;
				}
				return true;
			}
		</script>
	</head>
	<body>
		<form action="regist.jsp" onsubmit="return checkUser()">
			<table b>
				<tr>
					<td>用户名：</td>
					<td><input type="text" name="username" id="" value="" /></td>
				</tr>
				<tr>
					<td>密码:</td>
					<td><input type="password" name="password" id="" value="" /></td>
				</tr>
				<tr>
					<td></td>
					<td><input type="submit" name="" id="" value="注册" /></td>
				</tr>
			</table>
		</form>
	</body>
</html>
